﻿#region copyright
//<copyright>
// Copyright(C) 2012 TrackerRealm Corporation
// This file is part of the open source project - Jazz. http://jazz.codeplex.com
// 
// Jazz is open software: you can redistribute it and/or modify it 
// under the terms of the GNU Affero General Public License (AGPL) as published by 
// the Free Software Foundation, version 3 of the License.
// 
// Jazz is distributed in the hope that it will be useful, 
// but WITHOUT ANY WARRANTY; without even the implied warranty 
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
//  See the GNU Affero General Public License (AGPL) for more details.
// 
// You should have received a copy of the GNU General Public 
// License along with Jazz.  If not, see <http://www.gnu.org/licenses/>.
//
// REMOVAL OF THIS NOTICE IS VIOLATION OF THE COPYRIGHT. 
//</copyright>
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Reflection;

namespace TrackerRealm.Jazz.Client
{
    /// <summary>
    /// 
    /// </summary>
    public enum JazzFlagsType
    {
        /// <summary>
        /// 
        /// </summary>
        Initialized = 1,
        /// <summary>
        /// 
        /// </summary>
        Bound = 2,
        /// <summary>
        /// 
        /// </summary>
        Empty = 4,
        /// <summary>
        /// 
        /// </summary>
        ReadOnly = 8,
        /// <summary>
        /// When set specifies that the Jazz object is a 'Root' object.
        /// This is used for garbage collection.
        /// </summary>
        Root = 16,
        /// <summary>
        /// This identifies the '<see cref="jObject"/>' as a link object.
        /// This means that this instance contains no data and merely represents a 
        /// link to a valid object.
        /// <para>The client nexus will attempt to resolve the link instance when it is used.</para>
        /// </summary>
        Link = 32,
        /// <summary>
        /// When set specifies that the Jazz object is not accessible.
        /// A 'AccessViolationException' will occur if an attempt is made to access an object with 
        /// this bit set.
        /// </summary>
        NotAccessible = 64,
        /// <summary>
        /// 
        /// </summary>
        AccessibilitySet = 128
    }
    /// <summary>
    /// 
    /// </summary>
    public static class JazzObjectTypeExtensions
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="t"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public static JazzFlagsType Set(this JazzFlagsType t, JazzFlagsType value)
        {
            return (t  | value);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="t"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public static JazzFlagsType Reset(this JazzFlagsType t, JazzFlagsType value)
        {
            return t & (~value);
        }
        
    }
}
